﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Core="clr-namespace:SharpTalk.Core;assembly=SharpTalk.Core"
                    xmlns:Controls="clr-namespace:SharpTalk.Client.WpfApplication.Controls"
                    xmlns:Enums="clr-namespace:SharpTalk.Core.Enums;assembly=SharpTalk.Core"
                    xmlns:Views="clr-namespace:SharpTalk.Client.WpfApplication.Views"
                    xmlns:Resources="clr-namespace:SharpTalk.Client.WpfApplication.Resources">

    <Style TargetType="{x:Type ProgressBar}">
        <Setter Property="Foreground" Value="{StaticResource ProgressBarForegroundBrushKey}"/>
        <Setter Property="Background" Value="{StaticResource TransparentBrushKey}"/>
        <Setter Property="BorderBrush" Value="Silver"/>
        <Setter Property="BorderThickness" Value="0.5" />
        <Setter Property="Height" Value="18"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect Opacity="0.3" ShadowDepth="2" Direction="270" />
            </Setter.Value>
        </Setter>
    </Style>
    
    

   
    <Style x:Key="SeparatorDefaultStyle" TargetType="{x:Type Separator}">
        <Setter Property="Background" Value="{StaticResource LightGrayBrushKey}"/>
    </Style>

    <Style x:Key="MenuItemChatRoomJoinStyle" TargetType="{x:Type MenuItem}">
        <Setter Property="Command" Value="{Binding Path=DataContext.ChatRoomJoinCommand, RelativeSource={RelativeSource AncestorType={x:Type Views:MainWindow}}}"/>
        <Setter Property="CommandParameter" Value="{Binding}"/>
        <Setter Property="Header" Value="{Binding Name}"/>
        <Setter Property="Icon" Value="{Binding Type, Converter={StaticResource ChatRoomTypeEnumToImageConverter}}"/>
        <Setter Property="ToolTip" Value="{Binding Type, Converter={StaticResource ChatRoomTypeEnumConverter}}"/>
    </Style>

    <Style x:Key="MenuItemContactStyle" TargetType="{x:Type MenuItem}">
        <Setter Property="CommandParameter" Value="{Binding}"/>
        <Setter Property="Header" Value="{Binding FullName}"/>
    </Style>

    <Style x:Key="FlatButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border x:Name="Border" BorderThickness="1" BorderBrush="{StaticResource TransparentBrushKey}" Background="{StaticResource TransparentBrushKey}" CornerRadius="2">
                        <ContentPresenter
                            Margin="1"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"/>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Unfocused"/>
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush.Color">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GrayBlueColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource AlphaGrayBlueColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.3" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush.Color">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource UltraLightGrayColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GrayBlueColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush.Color">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GrayBlueColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource AlphaGrayBlueColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames
                                            Storyboard.TargetName="Border"
                                            Storyboard.TargetProperty="Opacity">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.5"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsDefault" Value="True"/>
                                <Condition Property="IsEnabled" Value="True"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource GrayBlueBrushKey}" />
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="FlatRepeatButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{StaticResource TransparentBrushKey}" Background="{StaticResource TransparentBrushKey}" CornerRadius="2">
                        <ContentPresenter
                            Margin="1"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"/>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Unfocused"/>
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush.Color">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GrayBlueColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource UltraLightGrayColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.3" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush.Color">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource UltraLightGrayColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GrayBlueColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush.Color">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GrayBlueColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="Border">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource UltraLightGrayColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames
                                            Storyboard.TargetName="Border"
                                            Storyboard.TargetProperty="Opacity">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0.5"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="DialogButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource FlatButtonStyle}">
        <Setter Property="MinWidth" Value="75"/>
        <Setter Property="MinHeight" Value="23"/>
        <Setter Property="Margin" Value="2,7,7,11"/>
    </Style>

    <Style x:Key="TopbarActionButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource FlatButtonStyle}">
        <Setter Property="Margin" Value="1" />
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Width" Value="12"/>
        <Setter Property="Height" Value="12"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
    </Style>

    <Style x:Key="TabItemButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource FlatButtonStyle}">
        <Setter Property="Visibility" Value="Collapsed"/>
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Margin" Value="2,1,1,0"/>
        <Setter Property="Width" Value="12"/>
        <Setter Property="Height" Value="12"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Right"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="IsTabStop" Value="False"/>
    </Style>

    <Style x:Key="TabItemCloseButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource TabItemButtonStyle}">
        <Setter Property="ToolTip" Value="{x:Static Resources:Messages.label_close}"/>
    </Style>

    <Style x:Key="TabItemEditButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource TabItemButtonStyle}">
        <Setter Property="ToolTip" Value="{x:Static Resources:Messages.label_chatroom_edit}"/>
    </Style>

    <Style x:Key="WindowMenuStyle" TargetType="{x:Type ContentControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContentControl}">
                    <Border CornerRadius="0,0,2,2" Background="Red" Padding="1" BorderThickness="1">
                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="WindowBaseStyle" TargetType="{x:Type Views:WindowBase}">
        <Setter Property="AllowsTransparency" Value="True"/>
        <Setter Property="WindowStyle" Value="None" />
        <Setter Property="Background" Value="{StaticResource WhiteBrushKey}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Views:WindowBase}">
                    <Border x:Name="root" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3">
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>

                            <!-- Top Bar -->
                            <Border x:Name="topBar" Grid.Row="0" Margin="0,0,0,5" Background="{TemplateBinding TopBarBackground}" BorderBrush="{TemplateBinding TopBarBorderBrush}" BorderThickness="{TemplateBinding TopBarBorderThickness}" CornerRadius="2,2,0,0">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <!--<ContentControl Style="{StaticResource WindowMenuStyle}" Content="{TemplateBinding Menu}" Visibility="{Binding HasMenu,RelativeSource={RelativeSource AncestorType=Views:WindowBase}, Converter={StaticResource BooleanToVisibilityConverter}}" Grid.Column="0" />-->
                                    <Image x:Name="WindowIcon" Margin="2" Grid.Column="1" Source="{TemplateBinding Icon}" Style="{StaticResource ImageSmallWithShadowStyle}" />
                                    <TextBlock x:Name="WindowTitle" Margin="2" Grid.Column="2" Text="{TemplateBinding Title}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                    <StackPanel x:Name="TopbarActionButtonsPanel" Margin="0,2,2,2" Grid.Column="3" HorizontalAlignment="Right" Orientation="Horizontal">
                                        <Button Margin="1" x:Name="BtnMinimize" ToolTip="{x:Static Resources:Messages.label_minimize_window}" Command="{Binding MinimizeCommand, RelativeSource={RelativeSource AncestorType=Views:WindowBase}}" Style="{StaticResource TopbarActionButtonStyle}" Visibility="{TemplateBinding ShowMinimizeButton, Converter={StaticResource BooleanToVisibilityConverter}}">
                                            <Path Data="M 0,6 L 8,6" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="2" />
                                        </Button>
                                        <Button Margin="1" x:Name="BtnMaximize" ToolTip="{x:Static Resources:Messages.label_maximize_window}" Command="{Binding MaximizeCommand, RelativeSource={RelativeSource AncestorType=Views:WindowBase}}" Style="{StaticResource TopbarActionButtonStyle}" Visibility="{TemplateBinding ShowMaximizeButton, Converter={StaticResource BooleanToVisibilityConverter}}">
                                            <Grid>
                                                <Path Data="M 0,0 L 8,0" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1.5" />
                                                <Path Data="M 8,0 L 8,8" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1.5" />
                                                <Path Data="M 8,8 L 0,8" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1.5" />
                                                <Path Data="M 0,8 L 0,0" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1.5" />
                                            </Grid>
                                        </Button>
                                        <Button Margin="1" x:Name="BtnClose" ToolTip="{x:Static Resources:Messages.label_close_window}" Command="{Binding CloseCommand, RelativeSource={RelativeSource AncestorType=Views:WindowBase}}" Style="{StaticResource TopbarActionButtonStyle}" Visibility="{TemplateBinding ShowCloseButton, Converter={StaticResource BooleanToVisibilityConverter}}">
                                            <Grid>
                                                <Path Data="M 0,0 L 8,8" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1.5" />
                                                <Path Data="M 8,0 L 0,8" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1.5" />
                                            </Grid>
                                        </Button>
                                    </StackPanel>
                                </Grid>
                                <Border.Effect>
                                    <DropShadowEffect Opacity="0.5" ShadowDepth="2" BlurRadius="4" Direction="270" />
                                </Border.Effect>
                            </Border>

                            <!-- Content -->
                            <AdornerDecorator Grid.Row="1">
                                <ContentPresenter
                                    VerticalAlignment="Stretch"
                                    HorizontalAlignment="Stretch"
                                    RecognizesAccessKey="True"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}" />
                            </AdornerDecorator>

                            <!-- ResizeGrip-->
                            <ResizeGrip 
                                x:Name="WindowResizeGrip"
                                Grid.Row="1"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Bottom"
                                Visibility="Collapsed"
                                IsTabStop="false" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="ResizeMode" Value="CanResizeWithGrip">
                            <Setter TargetName="WindowResizeGrip" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="WindowState" Value="Normal">
                            <Setter TargetName="BtnMaximize" Property="ToolTip" Value="{x:Static Resources:Messages.label_maximize_window}" />
                        </Trigger>
                        <Trigger Property="WindowState" Value="Maximized">
                            <Setter TargetName="BtnMaximize" Property="ToolTip" Value="{x:Static Resources:Messages.label_restore_window}" />
                        </Trigger>
                        <Trigger Property="IsActive" Value="False">
                            <Trigger.ExitActions>
                                <RemoveStoryboard BeginStoryboardName="TopbarStoryBoard"/>
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard x:Name="TopbarStoryBoard">
                                    <Storyboard>
                                        <DoubleAnimation
                                            AutoReverse="False"
                                            BeginTime="00:00:00"
                                            Duration="00:00:00.3"
                                            Storyboard.TargetName="topBar"
                                            Storyboard.TargetProperty="Opacity"
                                            From="1.0"
                                            To="0.5">
                                        </DoubleAnimation>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Setter TargetName="topBar" Property="Effect" Value="{x:Null}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MessageViewStyle" TargetType="{x:Type Views:WindowBase}" BasedOn="{StaticResource WindowBaseStyle}">
        <Setter Property="BorderThickness" Value="1.2" />
        <Setter Property="BorderBrush" Value="#FFC1C1C1"/>
        <Setter Property="ShowInTaskbar" Value="False"/>
        <Setter Property="SizeToContent" Value="WidthAndHeight"/>
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="ResizeMode" Value="CanResizeWithGrip" />
        <Setter Property="Icon" Value="{x:Null}"/>
        <Setter Property="ShowCloseButton" Value="True"/>
        <Setter Property="ShowMinimizeButton" Value="False"/>
        <Setter Property="ShowMaximizeButton" Value="False" />
        <Setter Property="TopBarBackground">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                    <GradientStop Color="{StaticResource UltraLightGrayColor}" Offset="0" />
                    <GradientStop Color="{StaticResource WhiteColor}" Offset="0.1" />
                    <GradientStop Color="#FFC1C1C1" Offset="0.85" />
                    <GradientStop Color="#FFDBDBDB" Offset="1" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MainWindowStyle" TargetType="{x:Type Views:WindowBase}" BasedOn="{StaticResource MessageViewStyle}">
        <Setter Property="ShowInTaskbar" Value="True"/>
        <Setter Property="ResizeMode" Value="CanResizeWithGrip" />
        <Setter Property="ShowCloseButton" Value="True"/>
        <Setter Property="ShowMinimizeButton" Value="True"/>
        <Setter Property="ShowMaximizeButton" Value="False" />
        <Setter Property="SizeToContent" Value="Manual"/>
        <Setter Property="Width" Value="525"/>
        <Setter Property="Height" Value="330"/>
    </Style>

    <Style x:Key="HorizontalScrollViewerStyle" TargetType="{x:Type ScrollViewer}">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="CanContentScroll" Value="True"/>
        <Setter Property="VerticalScrollBarVisibility" Value="Hidden"/>
        <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="Background" Value="{StaticResource TransparentBrushKey}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" MaxWidth="16"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto" MaxWidth="16"/>
                        </Grid.ColumnDefinitions>

                        <RepeatButton
                            x:Name="ScrollLeftButton"
                            Grid.Column="0"
                            Style="{StaticResource FlatRepeatButtonStyle}"
                            BorderThickness="0,1,1,1"
                            Width="16"
                            Margin="-1,0,0,0"
                            Command="ScrollBar.PageLeftCommand"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}">
                            <Grid HorizontalAlignment="Left">
                                <Path x:Name="DecreaseArrow" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1" Data="M 0 4 L 4 8 L 4 0 Z"/>
                            </Grid>
                        </RepeatButton>

                        <ScrollContentPresenter
                            x:Name="PART_ScrollContentPresenter"
                            Grid.Column="1"
                            Margin="{TemplateBinding Padding}"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            CanContentScroll="{TemplateBinding CanContentScroll}"/>

                        <RepeatButton
                            x:Name="ScrollRightButton"
                            Grid.Column="2"
                            Style="{StaticResource FlatRepeatButtonStyle}"
                            BorderThickness="1,1,0,1"
                            Width="16"
                            Margin="0,0,-1,0"
                            Command="ScrollBar.PageRightCommand"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}">
                            <Grid HorizontalAlignment="Right">
                                <Path x:Name="IncreaseArrow" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1" Data="M 0 8 L 4 4 L 0 0 Z"/>
                            </Grid>
                        </RepeatButton>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Visibility" Value="Hidden" SourceName="ScrollLeftButton">
                            <Setter Property="Visibility" TargetName="ScrollLeftButton" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="Visibility" Value="Hidden" SourceName="ScrollRightButton">
                            <Setter Property="Visibility" TargetName="ScrollRightButton" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Menu}">
        <Setter Property="Background" Value="{StaticResource WhiteBrushKey}" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Menu}">
                    <Border BorderThickness="1" Background="{TemplateBinding Background}">
                        <ScrollViewer CanContentScroll="True" Style="{StaticResource HorizontalScrollViewerStyle}">
                            <StackPanel 
                                Margin="2,0,0,2"
                                Background="{TemplateBinding Background}"
                                ClipToBounds="True"
                                Orientation="Horizontal"
                                IsItemsHost="True" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <!--MenuItem.TopLevelHeader-->
    <ControlTemplate x:Key="{x:Static MenuItem.TopLevelHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border x:Name="Border" BorderThickness="1">
            <Grid>
                <ContentPresenter 
                    Margin="6,1,6,1"
                    ContentSource="Header"
                    RecognizesAccessKey="True" />
                <Popup x:Name="Popup"
                        Placement="Bottom"
                        IsOpen="{TemplateBinding IsSubmenuOpen}"
                        AllowsTransparency="True"
                        Focusable="False" 
                        VerticalOffset="-1"
                        HorizontalOffset="-1"
                        PopupAnimation="Fade">
                    <Border x:Name="SubmenuBorder"
                            SnapsToDevicePixels="True"
                            BorderThickness="1"
                            Background="{StaticResource LightBlueBrushKey}"
                            BorderBrush="{StaticResource TransparentBrushKey}">
                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                    </Border>
                </Popup>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSuspendingPopupAnimation" Value="True">
                <Setter TargetName="Popup" Property="PopupAnimation" Value="None" />
            </Trigger>
            <Trigger Property="IsHighlighted" Value="True">
                <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource LightGrayBrushKey}" />
                <Setter Property="Background"  TargetName="Border" Value="{StaticResource AlphaGrayBlueBrushKey}" />
                <Setter Property="CornerRadius"  TargetName="Border" Value="2" />
            </Trigger>
            <Trigger Property="IsSubmenuOpen" Value="True">
                <Setter Property="Background" TargetName="Border" Value="{StaticResource LightBlueBrushKey}"/>
                <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource TransparentBrushKey}" />
                <Setter Property="CornerRadius"  TargetName="Border" Value="2,2,0,0" />
                <Setter Property="BorderThickness" TargetName="Border" Value="1,1,1,0" />
                <Setter Property="Effect" TargetName="Border" Value="{StaticResource DropShadowEffectLight}"/>
            </Trigger>
            <Trigger SourceName="Popup" Property="AllowsTransparency" Value="True">
                <Setter TargetName="SubmenuBorder" Property="CornerRadius" Value="0,3,3,3" />
                <Setter TargetName="SubmenuBorder" Property="Padding" Value="0,0,0,0" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource DisabledForegroundColor}" />
                    </Setter.Value>
                </Setter>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- MenuItem.TopLevelItem -->
    <ControlTemplate x:Key="{x:Static MenuItem.TopLevelItemTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border x:Name="Border">
            <Grid>
                <ContentPresenter
                        Margin="6,1,6,1"
                        ContentSource="Header"
                        RecognizesAccessKey="True" />
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsHighlighted" Value="True">
                <Setter Property="Background" TargetName="Border" Value="{StaticResource AlphaGrayBlueBrushKey}" />
                <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource LightGrayBrushKey}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource DisabledForegroundColor}" />
                    </Setter.Value>
                </Setter>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- MenuItem.SubmenuItem -->
    <ControlTemplate x:Key="{x:Static MenuItem.SubmenuItemTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border x:Name="Border" BorderThickness="1" Margin="2,0" >
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Icon" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut" />
                    <ColumnDefinition Width="13" />
                </Grid.ColumnDefinitions>
                <ContentPresenter 
                        x:Name="Icon"
                        Margin="6,3,0,3"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        ContentSource="Icon" />
                <Border x:Name="Check"
                        Width="16"
                        Height="16"
                        Margin="6,3,0,3"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Visibility="Collapsed">
                    <Path x:Name="CheckMark" 
                          Visibility="Hidden"
                          SnapsToDevicePixels="False"
                          HorizontalAlignment="Center"
                          VerticalAlignment="Center"
                          StrokeThickness="2"
                          Data="M 1 6 L 6 12 M 6 12 L 12 1">
                        <Path.Stroke>
                            <SolidColorBrush Color="{StaticResource DarkGrayBlueColor}"/>
                        </Path.Stroke>
                    </Path>
                </Border>
                <ContentPresenter 
                        x:Name="HeaderHost"
                        Grid.Column="1"
                        ContentSource="Header"
                        Margin="6,3,0,3"
                        VerticalAlignment="Center"
                        RecognizesAccessKey="True" />
                <TextBlock 
                        x:Name="InputGestureText"
                        Grid.Column="2"
                        Text="{TemplateBinding InputGestureText}"
                        Margin="6,3,0,3"
                        DockPanel.Dock="Right" />
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="ButtonBase.Command" Value="{x:Null}" />
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Hidden" />
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="CheckMark" Property="Visibility" Value="Visible" />
            </Trigger>
            <Trigger Property="IsCheckable" Value="true">
                <Setter TargetName="Check" Property="Visibility" Value="Visible" />
                <Setter TargetName="Icon" Property="Visibility" Value="Hidden" />
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter Property="CornerRadius" TargetName="Border" Value="2" />
                <!--<Setter Property="Background" TargetName="Border" Value="{StaticResource AlphaWhiteBrushKey}" />-->
                <Setter Property="Background" TargetName="Border" Value="{StaticResource AlphaWhiteLinearBrushKey}">
                    
                </Setter>
                <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource GrayBlueBrushKey}" />
                <Setter Property="Effect" TargetName="Icon" Value="{StaticResource DropShadowEffectLight}" />
                <Setter Property="Effect" TargetName="CheckMark" Value="{StaticResource DropShadowEffectLight}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource DisabledForegroundColor}" />
                    </Setter.Value>
                </Setter>
                <Setter Property="Opacity" TargetName="Border" Value="0.5"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--MenuItem.SubmenuHeader-->
    <ControlTemplate x:Key="{x:Static MenuItem.SubmenuHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
        <Border x:Name="Border" BorderThickness="1" Margin="2,0">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Icon" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut" />
                    <ColumnDefinition Width="13" />
                </Grid.ColumnDefinitions>
                <ContentPresenter x:Name="Icon"
                        Margin="6,3,0,3"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        ContentSource="Icon" />
                <ContentPresenter x:Name="HeaderHost"
                        Grid.Column="1"
                        Margin="6,3,0,3"
                        ContentSource="Header"
                        VerticalAlignment="Center"
                        RecognizesAccessKey="True" />
                <TextBlock x:Name="InputGestureText"
                         Grid.Column="2"
                         Text="{TemplateBinding InputGestureText}"
                         Margin="6,3,0,3"
                         DockPanel.Dock="Right" />
                <Path Grid.Column="3"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Data="M 0 0 L 0 7 L 4 3.5 Z" >
                    <Path.Fill>
                        <SolidColorBrush Color="{StaticResource GlyphColor}"/>
                    </Path.Fill>
                </Path>
                <Popup x:Name="Popup"
                         Placement="Right"
                         HorizontalOffset="1"
                         IsOpen="{TemplateBinding IsSubmenuOpen}"
                         AllowsTransparency="True"
                         Focusable="False"
                         PopupAnimation="Fade">
                    <Border x:Name="SubmenuBorder"
                            SnapsToDevicePixels="True"
                            BorderThickness="1" 
                            Background="{StaticResource WhiteBrushKey}"
                            BorderBrush="{StaticResource LightGrayBrushKey}">
                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
                    </Border>
                </Popup>
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
            </Trigger>
            <Trigger Property="IsHighlighted" Value="True">
                <Setter Property="CornerRadius" TargetName="Border" Value="2" />
                <Setter Property="Background" TargetName="Border" Value="{StaticResource AlphaLightBlueBrushKey}" />
                <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource GrayBlueBrushKey}" />
                <Setter Property="Effect" TargetName="Icon" Value="{StaticResource DropShadowEffectLight}" />
            </Trigger>
            <Trigger SourceName="Popup" Property="AllowsTransparency" Value="True">
                <Setter TargetName="SubmenuBorder" Property="CornerRadius" Value="2" />
                <Setter TargetName="SubmenuBorder" Property="Padding" Value="0,2,0,2" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground">
                    <Setter.Value>
                        <SolidColorBrush Color="{StaticResource DisabledForegroundColor}" />
                    </Setter.Value>
                </Setter>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}">
        <Setter Property="Background" Value="{StaticResource WhiteBrushKey}"/>
        <Setter Property="Margin" Value="0,1"/>
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Style.Triggers>
            <Trigger Property="Role" Value="TopLevelHeader">
                <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.TopLevelHeaderTemplateKey}}" />
                <Setter Property="Grid.IsSharedSizeScope" Value="True" />
            </Trigger>
            <Trigger Property="Role" Value="TopLevelItem">
                <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.TopLevelItemTemplateKey}}" />
            </Trigger>
            <Trigger Property="Role" Value="SubmenuHeader">
                <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.SubmenuHeaderTemplateKey}}" />
            </Trigger>
            <Trigger Property="Role" Value="SubmenuItem">
                <Setter Property="Template" Value="{StaticResource {x:Static MenuItem.SubmenuItemTemplateKey}}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
        <Setter Property="Height" Value="0.5" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <Border BorderThickness="1" BorderBrush="{StaticResource LightGrayBrushKey}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="ImageListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="{StaticResource TransparentBrushKey}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border x:Name="Border" CornerRadius="3" Padding="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Image x:Name="Image" Source="{Binding}" Style="{StaticResource ImageLargeStyle}" Stretch="Fill" Margin="5,2"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="RenderTransform" TargetName="Image">
                                <Setter.Value>
                                    <ScaleTransform ScaleX="1.05" ScaleY="1.05"/>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Effect" TargetName="Image" Value="{StaticResource DropShadowEffectLight}"/>
                        </Trigger>
                        <Trigger Property="Selector.IsSelected" Value="True">
                            <Setter Property="Panel.Background" TargetName="Border" Value="{StaticResource LightGrayBrushKey}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ImageListBoxStyle" TargetType="{x:Type ListBox}">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="{StaticResource TransparentBrushKey}"/>
        <Setter Property="ItemContainerStyle" Value="{StaticResource ImageListBoxItemStyle}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Border x:Name="Border" CornerRadius="3" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <ScrollViewer Style="{StaticResource HorizontalScrollViewerStyle}">
                            <StackPanel Orientation="Horizontal" IsItemsHost="True" />
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsGrouping" Value="True">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollViewerBaseStyle" TargetType="{x:Type ScrollViewer}">
        <Setter Property="Foreground" Value="{StaticResource DarkGrayBlueBrushKey}"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
    </Style>

    <Style x:Key="UserDetailsControlStyle" TargetType="{x:Type Controls:UserListViewItem}">
        <Setter Property="Foreground" Value="{StaticResource DarkGrayBlueBrushKey}"/>
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="CornerBrush" Value="Silver" />
        <Setter Property="ShowImage" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="BorderBackgroundBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="{StaticResource WhiteColor}" Offset="0" />
                    <GradientStop Color="Silver" Offset="1" />
                    <GradientStop Color="{StaticResource UltraLightGrayColor}" Offset="0.8" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsEnabled" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="CornerBrush" Value="{StaticResource DarkGrayBlueBrushKey}"/>
                <Setter Property="ShowActionButtons" Value="True" />
            </MultiTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBackgroundBrush" Value="{StaticResource VeryLightGrayBrushKey}"/>
                <Setter Property="CornerBrush" Value="{StaticResource VeryLightGrayBrushKey}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="UserListItemStyle" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border CornerRadius="3" BorderThickness="{TemplateBinding Border.BorderThickness}" Padding="{TemplateBinding Control.Padding}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}" Name="Bd" SnapsToDevicePixels="True">
                        <ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Selector.IsSelected" Value="True">
                            <Setter Property="Panel.Background" TargetName="Bd" Value="{StaticResource TransparentBrushKey}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate DataType="{x:Type Core:User}">
                    <Controls:UserListViewItem
                        Style="{StaticResource UserDetailsControlStyle}"
                        ShowUserStatus="{Binding ShowUserStatus, RelativeSource={RelativeSource AncestorType=Controls:UserListView}}"
                        CurrentUser="{Binding}"
                        AddContactCommand="{Binding AddContactCommand, RelativeSource={RelativeSource AncestorType=Controls:UserListView}}"/>
                    <DataTemplate.Triggers>
                        <DataTrigger Binding="{Binding Status}" Value="{x:Static Enums:UserStatusEnum.Offline}">
                            <Setter Property="IsEnabled" Value="False"/>
                        </DataTrigger>
                    </DataTemplate.Triggers>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="RepeatButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Grid>
                        <Border CornerRadius="3" x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
                        <ContentPresenter HorizontalAlignment="Center" x:Name="ContentPresenter" VerticalAlignment="Center" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" Value="{StaticResource VeryLightGrayBrushKey}" TargetName="Border"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="RepeatButtonStyleUp" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource RepeatButtonStyle}">
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="{StaticResource WhiteColor}" Offset="0" />
                    <GradientStop Color="Silver" Offset="1" />
                    <GradientStop Color="{StaticResource UltraLightGrayColor}" Offset="0.8" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsPressed" Value="true">
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="{StaticResource WhiteColor}" Offset="1" />
                            <GradientStop Color="Silver" Offset="0" />
                            <GradientStop Color="{StaticResource UltraLightGrayColor}" Offset="0.2" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="RepeatButtonStyleDown" TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource RepeatButtonStyle}">
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="{StaticResource WhiteColor}" Offset="0" />
                    <GradientStop Color="Silver" Offset="1" />
                    <GradientStop Color="{StaticResource UltraLightGrayColor}" Offset="0.8" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsPressed" Value="true">
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="{StaticResource WhiteColor}" Offset="1" />
                            <GradientStop Color="Silver" Offset="0" />
                            <GradientStop Color="{StaticResource UltraLightGrayColor}" Offset="0.2" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="UserListScrollViewerStyle" TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerBaseStyle}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid Background="{TemplateBinding Background}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="18"/>
                            <RowDefinition Height="1*"/>
                            <RowDefinition Height="18"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <ScrollContentPresenter Grid.Row="1" Grid.Column="0" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}"/>
                        <RepeatButton Style="{StaticResource RepeatButtonStyleUp}" Command="ScrollBar.LineUpCommand" Grid.Row="0" HorizontalAlignment="Stretch" Grid.Column="0">
                            <Grid>
                                <Path x:Name="IncreaseArrow" Stroke="{TemplateBinding Foreground}" StrokeThickness="1" Data="M 0 4 L 8 4 L 4 0 Z"/>
                            </Grid>
                        </RepeatButton>
                        <RepeatButton Command="ScrollBar.LineDownCommand" Grid.Row="2" HorizontalAlignment="Stretch" Style="{StaticResource RepeatButtonStyleDown}">
                            <Grid>
                                <Path x:Name="DecreaseArrow" Stroke="{TemplateBinding Foreground}" StrokeThickness="1" Data="M 0 0 L 4 4 L 8 0 Z"/>
                            </Grid>
                        </RepeatButton>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Effect" TargetName="IncreaseArrow" Value="{StaticResource DropShadowEffectLight}" />
                            <Setter Property="Effect" TargetName="DecreaseArrow" Value="{StaticResource DropShadowEffectLight}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="UserListStyle" TargetType="{x:Type ListBox}">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="{x:Null}"/>
        <Setter Property="BorderBrush" Value="{x:Null}"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
        <Setter Property="ScrollViewer.CanContentScroll" Value="True" />
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Grid>
                        <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
                        <ScrollViewer Style="{StaticResource UserListScrollViewerStyle}" Margin="1" Focusable="false" Background="{TemplateBinding Background}">
                            <StackPanel Margin="2" IsItemsHost="True"/>
                        </ScrollViewer>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsGrouping" Value="True">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TabItemChatRoomStyle" TargetType="{x:Type TabItem}">
        <Setter Property="Header" Value="{Binding Chatroom.Name}"/>
        <Setter Property="Content" Value="{Binding}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="IsSelected" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid x:Name="root">
                        <AdornerDecorator>
                            <Border x:Name="Border"
                                Margin="0,0,0,0"
                                BorderThickness="1,1,1,0"
                                CornerRadius="3,3,0,0" MinWidth="70"
                                BorderBrush="{StaticResource TransparentBrushKey}"
                                Background="{StaticResource TransparentBrushKey}">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Image Style="{StaticResource ImageChatRoomTypeStyle}" Margin="4,2,2,2" MaxWidth="16" Grid.Column="0" />
                                    <TextBlock x:Name="txtHeader" Margin="5,0,5,0" Text="{TemplateBinding Header}" VerticalAlignment="Center" HorizontalAlignment="Stretch" Grid.Column="1" ToolTip="{Binding Chatroom.Motd}"/>
                                    <StackPanel Grid.Column="2" Orientation="Horizontal" >
                                        <Button x:Name="btnEdit" Visibility="{Binding Chatroom, Converter={StaticResource ChatRoomEditableToVisibilityConverter}}" Style="{StaticResource TabItemEditButtonStyle}" Command="{Binding DataContext.ChatRoomEditCommand, RelativeSource={RelativeSource AncestorType=Views:MainWindow}}" CommandParameter="{Binding Chatroom}" >
                                            <Image Style="{StaticResource ImageStyleChatRoomEdit}"/>
                                        </Button>
                                        <Button x:Name="btnClose" Style="{StaticResource TabItemCloseButtonStyle}"  Command="{Binding DataContext.ChatRoomLeaveCommand, RelativeSource={RelativeSource AncestorType=Views:MainWindow}}" CommandParameter="{Binding Chatroom}" >
                                            <Grid>
                                                <Path Data="M 0 0 L 8 8" Stretch="Uniform" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1" />
                                                <Path Data="M 8 0 L 0 8" Stretch="Uniform" Stroke="{StaticResource TopBarPathStrokeBrushKey}" StrokeThickness="1" />
                                            </Grid>
                                        </Button>
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </AdornerDecorator>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState  x:Name="Unselected"/>
                                <VisualState x:Name="Selected"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.5" To="Normal" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" >
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource GrayBlueColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource DisabledBorderLightColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="100" />
                            <Setter Property="Background" TargetName="Border" Value="{StaticResource UltraLightGrayBrushKey}"/>
                            <Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource GrayBlueBrushKey}"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True" SourceName="Border" >
                            <Setter Property="Visibility" TargetName="btnClose" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ListBoxItemMessageStyle" TargetType="{x:Type ListBoxItem}">
        <Setter Property="IsSelected"  Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="Background" Value="{StaticResource WhiteBrushKey}"/>
        <Setter Property="BorderBrush" Value="{StaticResource LightGrayBrushKey}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="MaxWidth" Value="{Binding Path=Width, RelativeSource={RelativeSource AncestorType=Views:MainWindow}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border x:Name="root" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Effect="{TemplateBinding Effect}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3" Margin="{TemplateBinding Padding}" >
                        <Grid x:Name="TextContent">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock x:Name="msgDateTime" Grid.Column="0" Visibility="{Binding IsNotMotd,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="2" Text="{Binding DateTime, Converter={StaticResource DateTimeToStringConverter}}" HorizontalAlignment="Left"  VerticalAlignment="Top" />
                            <TextBlock x:Name="msgContent"  Margin="2,2,5,2" Grid.Column="1" Text="{Binding Content}" HorizontalAlignment="Stretch"  VerticalAlignment="Top" TextWrapping="Wrap" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding IsNotMotd}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard Name="messageStoryboard">
                                        <DoubleAnimation 
                                            From="0" 
                                            To="1" 
                                            Duration="00:00:00:0.2"
                                            Storyboard.TargetProperty="Opacity"
                                            Storyboard.TargetName="TextContent" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </DataTrigger.EnterActions>
                            <DataTrigger.ExitActions>
                                <StopStoryboard BeginStoryboardName="messageStoryboard"/>
                            </DataTrigger.ExitActions>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding IsNotMotd}" Value="False">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard Name="motdStoryboard">
                                        <DoubleAnimation 
                                            From="0" 
                                            To="1" 
                                            Duration="00:00:00:0.5"
                                            Storyboard.TargetProperty="Opacity"
                                            Storyboard.TargetName="root" />
                                        <ThicknessAnimation 
                                            From="-50,-50"
                                            Duration="00:00:00:0.3"
                                            Storyboard.TargetName="root"
                                            Storyboard.TargetProperty="Margin"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </DataTrigger.EnterActions>
                            <DataTrigger.ExitActions>
                                <RemoveStoryboard BeginStoryboardName="motdStoryboard"/>
                            </DataTrigger.ExitActions>
                            <Setter Property="Foreground" TargetName="msgContent" Value="{StaticResource RoyalBlueBrushKey}"/>
                            <Setter Property="FontWeight" TargetName="msgContent" Value="Bold"/>
                        </DataTrigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="UserDetailsToolTipStyle" TargetType="{x:Type ToolTip}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToolTip}">
                    <Border CornerRadius="3" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid Margin="5">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Image Grid.Column="0" Grid.RowSpan="3" VerticalAlignment="Top" HorizontalAlignment="Stretch" Source="{Binding Image, Converter={StaticResource BinaryToBitmapImageConverter}}" Style="{StaticResource ImageLargeStyle}" Stretch="Fill"/>
                            <TextBlock Grid.Column="1" Grid.Row="0" Text="{x:Static Resources:Messages.label_firstname}" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                            <TextBlock Grid.Column="2" Grid.Row="0" Text="{Binding FirstName}" Margin="2,2,5,2" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                            <TextBlock Grid.Column="1" Grid.Row="1" Text="{x:Static Resources:Messages.label_lastname}" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                            <TextBlock Grid.Column="2" Grid.Row="1" Text="{Binding LastName}" Margin="2,2,5,2" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                            <TextBlock Grid.Column="1" Grid.Row="2" Text="{x:Static Resources:Messages.label_nickname}" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                            <TextBlock Grid.Column="2" Grid.Row="2" Text="{Binding NickName}" Margin="2,2,5,2" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="DiscussionUsersListStyle" TargetType="{x:Type ItemsControl}">
        <Setter Property="Background" Value="{StaticResource LightGrayBrushKey}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ItemsControl}">
                    <Border CornerRadius="3" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <ScrollViewer Style="{StaticResource HorizontalScrollViewerStyle}">
                            <StackPanel Orientation="Horizontal" IsItemsHost="True" Effect="{StaticResource DropShadowEffectLight}" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate DataType="{x:Type Core:User}">
                    <Image x:Name="userImage" Margin="2" Source="{Binding Image, Converter={StaticResource BinaryToBitmapImageConverter}}" Style="{StaticResource ImageMediumStyle}" Stretch="Fill">
                        <Image.ToolTip>
                            <ToolTip Style="{StaticResource UserDetailsToolTipStyle}" Content="{Binding}"/>
                        </Image.ToolTip>
                    </Image>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="TabControlChatRoomStyle" TargetType="{x:Type TabControl}">
        <Setter Property="Control.Padding" Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid KeyboardNavigation.TabNavigation="Local">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <!-- Tabs Panel -->
                        <ScrollViewer Padding="0" Style="{StaticResource HorizontalScrollViewerStyle}" >
                            <TabPanel x:Name="HeaderPanel"
                                    Margin="3,2,2,0"
                                    IsItemsHost="True"
                                    Panel.ZIndex="1"
                                    Background="{StaticResource TransparentBrushKey}"
                                    KeyboardNavigation.TabIndex="1" />
                        </ScrollViewer>
                        <!-- Content -->
                        <Border x:Name="Border"
                                Grid.Row="1"
                                Background="{StaticResource WhiteBrushKey}"
                                BorderBrush="{StaticResource UltraLightGrayBrushKey}"
                                BorderThickness="1"
                                CornerRadius="2"
                                Margin="1,0,1,1"
                                KeyboardNavigation.TabNavigation="Local"
                                KeyboardNavigation.DirectionalNavigation="Contained"
                                KeyboardNavigation.TabIndex="2">
                            <ContentPresenter 
                                    Content="{TemplateBinding TabControl.SelectedContent}" 
                                    ContentTemplate="{TemplateBinding TabControl.SelectedContentTemplate}" 
                                    ContentStringFormat="{TemplateBinding TabControl.SelectedContentStringFormat}" 
                                    ContentSource="SelectedContent" 
                                    Name="PART_SelectedContentHost" 
                                    Margin="{TemplateBinding Control.Padding}" 
                                    SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate DataType="{x:Type Core:Discussion}">
                    <Border BorderThickness="1" CornerRadius="3" Margin="2,0,2,2">
                        <Border.BorderBrush>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="{StaticResource UltraLightGrayColor}" Offset="0" />
                                <GradientStop Color="{StaticResource WhiteColor}" Offset="1" />
                            </LinearGradientBrush>
                        </Border.BorderBrush>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" MaxHeight="48" />
                                <RowDefinition Height="3*" />
                                <RowDefinition Height="1*" />
                            </Grid.RowDefinitions>
                            <!-- ChatRoom Users -->
                            <ItemsControl Grid.Row="0" Style="{StaticResource DiscussionUsersListStyle}" ItemsSource="{Binding Users}"/>
                            <!-- Messages -->
                            <ListBox x:Name="ChatHistory" BorderThickness="0" Grid.Row="1" ItemsSource="{Binding Messages}" ItemContainerStyle="{StaticResource ListBoxItemMessageStyle}"  />
                            <GridSplitter Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Height="5" Background="{StaticResource UltraLightGrayBrushKey}" />
                            <!-- ChatBox -->
                            <Border x:Name="chatBoxRoot" Grid.Row="2" CornerRadius="3" Margin="2" BorderBrush="{StaticResource UltraLightGrayBrushKey}" BorderThickness="1">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <ToolBar Visibility="Collapsed" Grid.Row="0" HorizontalAlignment="Stretch" SnapsToDevicePixels="True">
                                        <ToggleButton x:Name="btnSpellCheck" IsChecked="True">
                                            <Image Style="{StaticResource ImageStyleChekSpelling}"/>
                                        </ToggleButton>
                                    </ToolBar>
                                    <TextBox x:Name="chatBox"
                                             Grid.Row="1"
                                             SpellCheck.IsEnabled="{Binding DataContext.CheckSpelling, RelativeSource={RelativeSource AncestorType=Views:MainWindow}}"
                                             Margin="2,5"
                                             BorderThickness="0"
                                             TextWrapping="Wrap"
                                             AcceptsReturn="True"
                                             Text="{Binding Path=CurrentText, UpdateSourceTrigger=PropertyChanged}"/>
                                </Grid>
                            </Border>
                        </Grid>
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MainContentStyle" TargetType="{x:Type ContentControl}">
        <Setter Property="Background" Value="{StaticResource WhiteBrushKey}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel Name="dp" LastChildFill="True">
                        <!-- Contacts Panel -->
                        <Border Name="contactsRoot" Visibility="{Binding Path=DataContext.HasContacts, RelativeSource={RelativeSource AncestorType=Views:MainWindow}, Converter={StaticResource BooleanToVisibilityConverter}}" Width="18" CornerRadius="3,0,0,3" DockPanel.Dock="Right" BorderBrush="Silver" BorderThickness="0" Background="{TemplateBinding Background}">
                            <Grid>
                                <Border  Name="header" CornerRadius="3,0,0,3" Margin="0,10,0,2" BorderThickness="1,1,0,1"  Background="White" BorderBrush="Gray" VerticalAlignment="Top" Width="18" Height="100">
                                    <Grid>
                                        <Image Width="16" Name="img" Style="{StaticResource ImageAddContactStyle}" VerticalAlignment="Top" Margin="1,5,0,0" Effect="{StaticResource DropShadowEffectLight}"/>
                                        <TextBlock Text="{x:Static Resources:Messages.label_contacts}" Margin="18,-20,-50,0" Width="Auto" Foreground="Gray" VerticalAlignment="Center" >
                                            <TextBlock.RenderTransform>
                                                <RotateTransform CenterX="0" CenterY="0" Angle="90"/>
                                            </TextBlock.RenderTransform>
                                        </TextBlock>
                                    </Grid>
                                    <Border.Effect>
                                        <DropShadowEffect Opacity="0.5" ShadowDepth="4"/>
                                    </Border.Effect>
                                </Border>
                                <Controls:UserListView
                                    x:Name="ulv"
                                    Margin="18,0,0,0"
                                    Grid.Column="1"
                                    BorderBrush="Silver"
                                    Users="{Binding Path=DataContext.Contacts, RelativeSource={RelativeSource AncestorType=Views:MainWindow}}"
                                    ShowUserStatus="True"
                                    Width="Auto"
                                    HorizontalAlignment="Right"/>
                            </Grid>
                        </Border>

                        <!-- ChatRoom Tabs -->
                        <TabControl x:Name="tcChatRooms"
                            Style="{StaticResource TabControlChatRoomStyle}"
                            ItemsSource="{Binding DataContext.Discussions, RelativeSource={RelativeSource AncestorType=Views:MainWindow}}" 
                            ItemContainerStyle="{StaticResource TabItemChatRoomStyle}">
                        </TabControl>
                    </DockPanel>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" SourceName="contactsRoot" Value="True">
                            <Setter Property="Width" Value="Auto" TargetName="contactsRoot"/>
                            <Setter Property="Margin" Value="0" TargetName="ulv"/>
                            <Setter Property="Visibility" Value="Collapsed" TargetName="header" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ApplicationStatesControlStyle" TargetType="{x:Type ItemsControl}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ItemsControl}">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
                        <ItemsPresenter/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Image Style="{StaticResource ApplicationStateImageStyle}" />
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>